<?php

namespace app\admin\service;

use app\admin\model\BoxIosReview;

class BoxIosReviewService extends BaseService
{
    /**
     * 构造函数
     * LevelService constructor.
     */
    public function __construct()
    {
        $this->model = new BoxIosReview();
    }

    public function getList()
    {
        $param = request()->param();
        // 查询条件
        $map = [];
        if (isset($param['bundle_id']) && !empty($param['bundle_id'])) {
            $map[] = ['bundle_id', '=', $param['bundle_id']];
        }
        if (isset($param['version']) && !empty($param['version'])) {
            $map[] = ['version', '=', $param['version']];
        }
        if (isset($param['time_range']) && !empty($param['time_range'])) {
            $map[] = ['create_time', 'between', [strtotime($param['time_range'][0]),strtotime($param['time_range'][1])]];
        }
        $map[] = ['mark','=', 0];
        $noticeModel = new BoxIosReview();
        $list = $noticeModel
            ->where($map)
            ->order('id', 'desc')
            ->paginate($param['limit']);
        $data['code'] = 0;
        $data['msg'] = '操作成功';
        $data['data'] = $list->items() ?? [];
        $data['count'] = $list->total() ?? 0;
        return $data;
//        return parent::getList($map);
    }

}